package org.xfy.ymcc.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.xfy.common.result.JsonResult;
import org.xfy.ymcc.dto.SendSmsDto;
import org.xfy.ymcc.service.IVerifycodeService;

import javax.validation.Valid;

@RestController
@RequestMapping("/verifycode")
public class VerifycodeController {
    @Autowired
    private IVerifycodeService verifycodeService;
    @GetMapping("/imageCode/{imageCodeKey}")
    public JsonResult imageCode(@PathVariable("imageCodeKey")String imageCodeKey){
        return verifycodeService.imageCode(imageCodeKey);
    }

    @PostMapping("/sendSmsCode")
    public JsonResult sendSmsCode(@Valid @RequestBody SendSmsDto sendSmsDto){
        return verifycodeService.sendSmsCode(sendSmsDto);
    }
}
